﻿using HrEFCore.Models;
using Microsoft.EntityFrameworkCore;

namespace HrEFCore
{
    public class MyDbContext : DbContext
	{
		public MyDbContext(DbContextOptions<MyDbContext> options)

		   : base(options)
		{
			//读取program
		}
		//1 配置连接字符串
		protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
		{
			//string connStr = "Data Source=DESKTOP-UI9U8SK;Initial Catalog=CRMDB;Integrated Security=True;Encrypt=False;";
			//optionsBuilder.UseSqlServer(connStr);
			//输出sql语句
			optionsBuilder.LogTo(msg =>
			{
				if (!msg.Contains("CommandExecuting"))
				{
					return;
				}
				Console.WriteLine(msg);
			});
		}
		//读取配置类
		protected override void OnModelCreating(ModelBuilder modelBuilder)
		{
			modelBuilder.ApplyConfigurationsFromAssembly(this.GetType().Assembly);
		}

        public DbSet<User> User { get; set; }
        public DbSet<CFTK> CFTK { get; set; }
        public DbSet<CM> CM { get; set; }
        public DbSet<CFFK> CFFK { get; set; }
		public DbSet<CFSK> CFSK { get; set; } 
		public DbSet<CPC> CPC { get; set; }
		public DbSet<CMK> CMK { get; set; }
        public DbSet<SS> SS { get; set; }
		public DbSet<EMR> EMR { get; set; }
		public DbSet<HF> HF { get; set; }
		public DbSet<SSD> SSD { get; set; }
		public DbSet<EMRView> EMRView { get; set; }
		public DbSet<ER> ER { get; set; }
        public DbSet<MC> MC { get; set; }
        public DbSet<Roles> Roles { get; set; }
        public DbSet<UserRoles> UserRoles { get; set; }
        public DbSet<View_UserRoles> View_UserRoles { get; set; }
        public DbSet<ERView> ERView { get; set; }

		public DbSet<ERView2> ERView2 { get; set; }

        public DbSet<EMRViewXG> EMRViewXG { get; set; }
        public DbSet<ERCheckIn> ERCheckIn { get; set; }
		public DbSet<ERSift> ERSift { get; set; }
		public DbSet<ERHired> ERHired { get; set; }
		public DbSet<ERHired2> ERHired2 { get; set; }
		public DbSet<ERHired3> ERHired3 { get; set; }
		public DbSet<ERHiredApplication> ERHiredApplication { get; set; }
        public DbSet<ERHiredApproval> ERHiredApproval { get; set; }
        public DbSet<ERHiredInquire> ERHiredInquire { get; set; }
         public DbSet<EI> EI { get; set; }
		public DbSet<SSandSSD> SSandSSD { get; set; }
        public DbSet<SSWhere> SSWhere { get; set; }
        public DbSet<SG> SG { get; set; }
		public DbSet<SGD> SGD { get; set; }
        public DbSet<Jurisdiction> Jurisdiction { get; set; }
        public DbSet<Menu> Menu { get; set; }
        public DbSet<RolesJurisdiction> RolesJurisdiction { get; set; }
        public DbSet<RolesJuri> RolesJuri { get; set; }
        public DbSet<ERDisPlay> ERDisPlay { get; set; }
        //public DbSet<SGXL> SGXL { get; set; }
    }
}